public class Test {
    public static void main(String[] args) {
        String name="I am wang qi";
        System.out.println(name.replace("wang qi","zhang san"));
        String s="hello world hello hello";
        System.out.println(s.replace("hello","hi"));//全部替换
        System.out.println(s.replaceAll("hello","hi"));//全部替换
        System.out.println(s.replaceFirst("hello","hi"));//替换第一个
    }
}
